package com.cskaoyan.crud;

import com.cskaoyan.bean.User;
import com.cskaoyan.mapper.UserMapper;
import com.cskaoyan.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

/**
 * 创建日期: 2022/10/14 17:18
 *
 * @author ciggar
 */
public class UpdateDemo {

    public static void main(String[] args) {

        SqlSession sqlSession = MybatisUtils.getSqlSession();

        UserMapper mapper = sqlSession.getMapper(UserMapper.class);

        User user = new User();
        user.setId(1002);

        user.setName("扈三娘");
        user.setAge(30);
        user.setNickname("一丈青");
        int affectedRows = mapper.updateUserById(user);


        System.out.println("affectedRows:" + affectedRows);
    }
}
